﻿using DataAccess.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using XYD.DataAccess;
using XYD.Framework.Data;
using XYD.Framework.Data.Dapper;
namespace DataAccess.DAL
{
  

   public class TagsDAL : BaseDAL
   {
       public const string TagsKey = "AGENT_TAGSS";
       public bool Insert(Tags Tags)
       {
           RedisHelper.Single_Remove_Itme(TagsKey);
           return CONN_TopicSharing.Insert<Tags>(Tags);
       }
       public bool Update(Tags Tags)
       {
           RedisHelper.Single_Remove_Itme(TagsKey);
           return CONN_TopicSharing.Update<Tags>(Tags);
       }
       public List<Tags> GetTagss()
       {
           if (!RedisHelper.Exist(TagsKey))
           {
               RedisHelper.Single_Set_Itme<List<Tags>>(TagsKey, CONN_TopicSharing.SQLQuery<Tags>("select * from Tags where state=1", null).ToList());
           }
           return RedisHelper.Single_Get_Itme<List<Tags>>(TagsKey);
       }
   }
}
